package com.hillfly.mybatis.shard;

import com.hillfly.mybatis.shard.annotation.ShardTable;
import com.hillfly.mybatis.shard.strategy.Strategy;

public class ShardParams {
    private Strategy strategy;
    private String[] excludes;
    private String[] includes;
    private boolean isInherit;

    public ShardParams() {

    }

    public ShardParams(Strategy strategy) throws IllegalAccessException, InstantiationException {
        this.strategy = strategy;
    }

    public void setProperties(ShardTable shardTable) {
        this.excludes = shardTable.excludes();
        this.includes = shardTable.includes();
        this.isInherit = shardTable.isInherit();
    }

    public Strategy getStrategy() {
        return strategy;
    }

    public ShardParams setStrategy(Strategy strategy) {
        this.strategy = strategy;
        return this;
    }

    public String[] getExcludes() {
        return excludes;
    }

    public ShardParams setExcludes(String[] excludes) {
        this.excludes = excludes;
        return this;
    }

    public String[] getIncludes() {
        return includes;
    }

    public ShardParams setIncludes(String[] includes) {
        this.includes = includes;
        return this;
    }

    public boolean isInherit() {
        return isInherit;
    }

    public void setInherit(boolean inherit) {
        isInherit = inherit;
    }
}
